With the popularization of smart devices, how to protect data in smart devices becomes a very important issue. Encryption is an effective method for implementing data protection. When an encryption system is deployed in a smart device, one of key issues is to ensure security of an encrypted key. Generally, to protect an encrypted key, the key cannot be stored in a plaintext format in a smart device; instead, each time a key is needed, a key is generated by using input of a user in interaction with the user.
In the prior art, a smart device provides an interface for a user, the user enters an American Standard Code for Information Interchange (ASCII) character string on the interface, and the character string and a salt value selected by the smart device are connected and then input to a key generating function, to generate a key; or a smart device provides an interface for a user, the user selects a group of pictures on the interface, where each picture is assigned a unique identifier (ID), and the IDs of the pictures selected by the user and a salt value are used as input to a key generating function, to generate a key.
Therefore, in the method of using a character string or a group of sequential pictures as input to a key generating function in the prior art, a user usually needs to memorize input of the user, which brings inconvenience for use by the user, and an input entropy of the key generating function is relatively small, which is prone to an attack by an attacker.